/* ------------- header info ----------
-- file name: jfunction
-- created: duyha
-- description: content all functions are created by jquery
-- ------------------------------- 
--
-- ----------- history info (mm/dd/yy)------------
-- 03/02/12	duyha	create 
*/

$(document).ready(function(){

	//resize image to fit banner image
	jQuery.fn.myResize=function(width,height){
		var imgWidth=$(this).width();
		var imgHeight=$(this).height();
		var rato=0;
		if(imgWidth>imgHeight)
			rato=width/imgWidth;
		else
			rato=height/imgHeight;
		//resize
		$(this).width(imgWidth*rato);
		$(this).height(imgHeight*rato);

		//central
		var position = $(this).position();
		
		//alert(parseInt($(this).css("margin-left")));
		$(this).css("margin-left",parseInt($(this).css("margin-left"))+(width-$(this).width())/2);
		$(this).css("margin-top",parseInt($(this).css("margin-top"))+(height-$(this).height())/2);
	}		
});